#include <unistd.h>
#include <iostream>
int main() {
    pid_t pid;
    pid = fork();
    if(-1 == pid)
        std::cout<<"创建进程失败"<<"\n";
    else if(0 == pid)
        std::cout<<"子进程中返回:"<<getpid()<<"\n";
    else
        std::cout<<"父进程中返回:"<<getppid()<<"\n";
    return 0;
}